//引入vue
import Vue from 'vue';
//引入vue-router
import VueRouter from 'vue-router';
//第三方库需要use一下才能用
Vue.use(VueRouter)

import AdminPage from '../views/AdminPage';
import UserPage from '../views/UserPage';
import Login  from '../views/Login.vue';
import Manager from '../views/Manager';
import Register from '../views/Register';
import LinkList from "../views/LinkList";
import LinkChart from "../views/ChartPage/LinkChart";
import ViewPage from "../views/ChartPage/ViewPage";
import File from "../views/file/File";
import User from "../views/user/User";
import Vip from "../views/user/Vip";
import More from "../views/user/More";
import Test from "../views/user/Text"


//定义routes路由的集合，数组类型
const routes=[
    //单个路由均为对象类型，path代表的是路径，component代表组件
    {
        path:'',
        redirect:"login",
        hidden:true
    },
    {
        path:'/LinkChart',
        component:LinkChart,
        hidden:true
    },
    {
        path:'/ViewPage',
        component:ViewPage,
        hidden:true
    },
    {
        path:"/Login",
        component:Login,
        hidden:true
    },
    {
        path:'/Register',
        name:'登录管理',
        component:Register
    },
    {
        path:'/UserPage',
        name:'登录管理',
        component:UserPage,
        children: [
            {
                path:'',
                name: '个人用户链接页面',
                component: User
            },
            {
                path:'/Test',
                name: "文本生成二维码",
                component: Test
            },
            {
                path:'/User',
                name: '个人用户链接页面',
                component: User
            },
            {
                path:'/Vip',
                name:'VIP页面',
                component: Vip
            },
            {
                path:'/File',
                name:'文件上传',
                component: File
            },
            {
                path:'/More',
                name:'批量生成',
                component: More
            }
        ]

    },
    {
        path:"/AdminPage",
        name:'后台管理',
        component:AdminPage,
        children:[
            {
                path:'',
                name:'管理员信息',
                component:Manager
            },
            {
                path:'/Manager',
                name:'管理员信息',
                component:Manager
            },
            {
                path:'/LinkList',
                name:'链接管理',
                component:LinkList
            },
        ]
    },


]

//实例化VueRouter并将routes添加进去
const router=new VueRouter({
//ES6简写，等于routes：routes
    routes,
    mode: "history"
});

//抛出这个这个实例对象方便外部读取以及访问
export default router
